package com.example.jcservice.client;

import com.dtflys.forest.annotation.*;
import com.dtflys.forest.callback.OnLoadCookie;
import com.dtflys.forest.callback.OnSaveCookie;
import com.dtflys.forest.http.ForestResponse;
import com.example.jcservice.stType.Send.ExamBody;
import com.example.jcservice.stType.Send.ScrodBody;
import java.util.Map;

public interface Jw {
    /**
     * 第一步先访问登录页面拿到 __VIEWSTATE 和 cookie 值
     */
    @Get(url = "http://jwweb.scujcc.cn/default2.aspx")
    ForestResponse loginBefore(OnSaveCookie onSaveCookie);

    /**
     *获取验证码
     */
    @Get(url = "http://jwweb.scujcc.cn/CheckCode.aspx")
    ForestResponse getCheckCode(OnLoadCookie onLoadCookie);

    /**
     *登录
     */
    @Post(url = "http://jwweb.scujcc.cn/default2.aspx")
    ForestResponse JwLogin(@Body Map<String, String> user, OnLoadCookie onLoadCookie);

    /**
     *考试安排查询
     */
    //第一步
    @Get(
            url = "http://jwweb.scujcc.cn/xskscx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121603",
            headers = {
            "Referer: http://jwweb.scujcc.cn/xs_main.aspx?xh=${studentID}",
            }
    )
    ForestResponse getExamFirst(@Var("studentID") String RefererStudentID,
                                @Var("studentName") String studentName,
                                OnLoadCookie onLoadCookie);
    //第二步
    @Post(
            url = "http://jwweb.scujcc.cn/xskscx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121603",
            headers = {
                    "Referer: http://jwweb.scujcc.cn/xskscx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121603",
            }
    )
    ForestResponse getExamInfo(
                               @Var("studentID") String RefererStudentID,
                               @Var("studentName") String RefererStudentName,
                               @Body ExamBody examBody,
                               OnLoadCookie onLoadCookie);

    /**
     *成绩查询第一步
     */
    @Get(
            url = "http://jwweb.scujcc.cn/xscjcx.aspx?",
            headers = {
                    "Content-type: text/html;charset=gb2312",
                    "Referer: http://jwweb.scujcc.cn/xs_main.aspx?xh=${studentID}",
            }
    )
    ForestResponse getScrodFirst(@Query Map<String, String> user , @Var("studentID") String studentID , OnLoadCookie onLoadCookie);
    /**
     *第二步
     */
    @Post(
            url = "http://jwweb.scujcc.cn/xscjcx.aspx?",
            headers = {
                    "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0",
                    "Referer: http://jwweb.scujcc.cn/xscjcx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121613",

            }
    )

    ForestResponse getScrodInfo(@Query Map<String, String> query , @Body ScrodBody scrodBody, @Var("studentID") String studentID , @Var("studentName") String studentName , OnLoadCookie onLoadCookie);

    /**
     * @Author 游同学
     * @Date 2021-8-8
     * @Description 教务网补考考试安排查询Api
     * */
    @Get(
            url = "http://jwweb.scujcc.cn/xsbkkscx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121615",
            headers = {
                    "Referer: http://jwweb.scujcc.cn/xs_main.aspx?xh=${studentID}",
            }
    )
    ForestResponse getExamAgainInfoFirst(
                            @Var("studentID") String StudentID,
                            @Var("studentName") String StudentName,
                            OnLoadCookie onLoadCookie
                                );


    @Post(
            url = "http://jwweb.scujcc.cn/xsbkkscx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121615",
            headers = {
                    "Referer: http://jwweb.scujcc.cn/xsbkkscx.aspx?xh=${studentID}&xm=${studentName}&gnmkdm=N121615",
            }
    )
    ForestResponse getExamAgainInfo(
                                        @Var("studentID") String StudentID,
                                        @Var("studentName") String StudentName,
                                        @Body ExamBody examBody,
                                        OnLoadCookie onLoadCookie
                                );


}
